/* blpapi_error.h     -*-C++-*- */
#ifndef INCLUDED_BLPAPI_ERROR
#define INCLUDED_BLPAPI_ERROR

#include <blpapi_defs.h>

#define BLPAPI_RESULTCODE(res) (res & 0xffff)
#define BLPAPI_RESULTCLASS(res) (res & 0xff0000)

#define BLPAPI_UNKNOWN_CLASS                0x00000
#define BLPAPI_INVALIDSTATE_CLASS           0x10000
#define BLPAPI_INVALIDARG_CLASS             0x20000
#define BLPAPI_IOERROR_CLASS                0x30000
#define BLPAPI_CNVERROR_CLASS               0x40000
#define BLPAPI_BOUNDSERROR_CLASS            0x50000
#define BLPAPI_NOTFOUND_CLASS               0x60000
#define BLPAPI_FLDNOTFOUND_CLASS            0x70000

#define BLPAPI_ERROR_UNKNOWN                 (BLPAPI_UNKNOWN_CLASS | 1)
#define BLPAPI_ERROR_ILLEGAL_ARG             (BLPAPI_INVALIDARG_CLASS | 2)
#define BLPAPI_ERROR_ILLEGAL_ACCESS          3  
#define BLPAPI_ERROR_INVALID_SESSION         (BLPAPI_INVALIDARG_CLASS | 4)
#define BLPAPI_ERROR_DUPLICATE_CORRELATIONID (BLPAPI_INVALIDARG_CLASS | 5)
#define BLPAPI_ERROR_INTERNAL_ERROR          (BLPAPI_UNKNOWN_CLASS | 6)
#define BLPAPI_ERROR_RESOLVE_FAILED          (BLPAPI_IOERROR_CLASS | 7)
#define BLPAPI_ERROR_CONNECT_FAILED          (BLPAPI_IOERROR_CLASS | 8)
#define BLPAPI_ERROR_ILLEGAL_STATE           (BLPAPI_INVALIDARG_CLASS | 9)
#define BLPAPI_ERROR_CODEC_FAILURE           10 
#define BLPAPI_ERROR_INDEX_OUT_OF_RANGE      (BLPAPI_BOUNDSERROR_CLASS | 11)
#define BLPAPI_ERROR_INVALID_CONVERSION      (BLPAPI_CNVERROR_CLASS | 12)
#define BLPAPI_ERROR_ITEM_NOT_FOUND          (BLPAPI_NOTFOUND_CLASS | 13)
#define BLPAPI_ERROR_IO_ERROR                (BLPAPI_IOERROR_CLASS | 14)
#define BLPAPI_ERROR_CORRELATION_NOT_FOUND   (BLPAPI_NOTFOUND_CLASS | 15)
#define BLPAPI_ERROR_SERVICE_NOT_FOUND       (BLPAPI_NOTFOUND_CLASS | 16)


#ifdef __cplusplus 
extern "C" {
#endif

BLPAPI_EXPORT
const char* blpapi_getLastErrorDescription(int resultCode);

#ifdef __cplusplus 
}
#endif


#endif // #ifndef INCLUDED_BLPAPI_ERROR
